Skip to content

BUG: Preserve column names in DataFrame.from_records when nrows=0 #62085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

yuanx749
Copy link
Contributor

@yuanx749 yuanx749 commented Aug 10, 2025

Follow up on #61143

@@ -2234,7 +2234,7 @@ def maybe_reorder(

if is_iterator(data):
if nrows == 0:
return cls()
return cls(columns=columns)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does index need to be preserved here as well?

@mroeschke mroeschke added the DataFrame DataFrame data structure label Aug 11, 2025
@mroeschke mroeschke added this to the 3.0 milestone Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DataFrame DataFrame data structure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: DataFrame.from_records() ignores columns with iterator and nrows=0
3 participants